/**
 * 
 */
package com.vivid.dynamics.gametrials.noengine.game.matching;

import java.util.HashMap;
import java.util.Map;

import android.view.SurfaceView;

import com.vivid.dynamics.gametrials.noengine.common.LogUtil;

/**
 * MVP -- Presenter<p/>
 * maintains a set of references for the:
 * <ul>
 * 	<li>Game Entity(s) / Game World</li>
 * 	<li>View(s) such as SurfaceView objects</li>
 * </ul>
 * Presenter is the bridging component between the View (V) and Model (M) of 
 * the application / game. Under the MVP design realm, there is no more
 * direct connection between the View (V) and the Model (M); instead the 
 * presenter (P) will bridge up the communication between them.
 * 
 * <p/>
 * @author kusanagihk<br/>
 * created at: Dec 3, 2011::11:29:43 PM
 */
public class Presenter {
	
	static final String TAG=Presenter.class.getName();
	
	/**
	 * logger for logging purpose<p/>
	 * <b>PS</b>. a better solution is to create a wrapper; so that this 
	 * Presenter is not bounded to any Logging specific packages.
	 */
	private LogUtil mLog;
	/*
	 * the active view to be rendered, displayed and accepts user interactions 
	 * (eg. touch event)<p/>
	 * <b>PS</b>. a better solution is to use a reference of a custom view 
	 * interface; since a method on gracefully disposing the view should be
	 * provided. E.g. mView.dispose();
	 */
	/**
	 *	the Map of SurfaceView Object(s) for rendering
	 */
	private Map<String, SurfaceView> mViews;
	
	/**
	 * ctor. Check for {@link #mLog "a better solution"}  mentioned on the Logging part
	 * @param pLog
	 */
	public Presenter(final LogUtil pLog) {
		this.mLog=pLog;
		this.mViews=new HashMap<String, SurfaceView>();
/*
 * TODO setup of mViews
 */
	}
	
	/**
	 * return the SurfaceView bounded by the pStatusCode. The SurfaceView
	 * can be NULL
	 * @param pStatusCode
	 * @return
	 */
	public SurfaceView getViewByStatus(final String pStatusCode) {
		SurfaceView aView=null;
		
		aView=this.mViews.get(pStatusCode);
		
		return aView;
	}
	
	
	
	
	/*
	 * method to set the ActiveView for the Activity/Game; check the 
	 * functionalities for the activeView at {@link #mActiveView here}
	 * @param pView
	 * @param pDestroyCurrentView
	 *
	public void setActiveView(final View pView, boolean pDestroyCurrentView) {
		
		if (pView!=null) {
			if (this.mActiveView!=null) {
				if (pDestroyCurrentView) {
// TODO: destroy the current view gracefully; end threads etc...

				}
			}
			this.mActiveView=pView;
			
		} else {
			if (this.mLog!=null) {
				this.mLog.w(TAG, "view to be set Active is null~");
			}
		}
	}
	*/
	
}
